package top.aicey.ai.sparring.processor;

import com.google.common.base.Joiner;
import top.aicey.ai.sparring.common.holder.SparringConfigProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class DefaultSparringContextProcessorSelector implements SparringContextProcessorSelector, NameGenerateProcessor{

    @Autowired
    private Map<String, SparringContextProcessor> contextProcessorMap;

    @Autowired
    private SparringConfigProperties properties;


    @Override
    public SparringContextProcessor get() {
        return contextProcessorMap.get(generate());
    }

    @Override
    public String generate() {
        return Joiner.on("").join(properties.getContextMode(),SparringContextProcessor.class.getSimpleName());
    }
}
